package hibari.server.lib;

import java.io.Serializable;
import java.text.MessageFormat;

public class AdminLogItem implements Serializable {
    private static final long serialVersionUID = -564710190183990609L;
    public static final int KIND_ERROR = 1;
    public static final int KIND_INFO = 0;

    private String contents;
    private int kind;

    public AdminLogItem(int kind, String contents) {
        super();
        this.kind = kind;
        this.contents = contents;
    }

    public AdminLogItem(String contents) {
        super();
        this.contents = contents;
    }

    public String getContents() {
        return this.contents;
    }

    public int getKind() {
        return this.kind;
    }

    public String render() {
        String className = this.kind == 0 ? "message-info" : "message-error";
        return MessageFormat.format("<li class=\"{1}\">{0}</li>", this.contents, className);
    }

    public void setContents(String contents) {
        this.contents = contents;
    }

    public void setKind(int kind) {
        this.kind = kind;
    }
}
